import base from './base.js'
export default function(url,method='GET',data={},options={loading:true}){
	return new Promise((resolve,reject)=>{
		
		if(options.loading){
			uni.showLoading({
			title:"数据加载中"
		})
		}
		
		uni.request({
			url:base.host+url,
			method,
			data,
			success:res => {
				if(res.data.status===200){
					uni.showToast({
						title:"数据加载完毕"
					})
				}
				resolve(res.data)
			},
			fail:error=> {
				reject(error)
			},
			complete() {
				uni.hideLoading()
			}
		})
	})
}